<!doctype html>
<html lang="en" class="locker">

	<head>
		<meta charset="UTF-8">
		<title>钱包盒子-用户注册</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../css/mui.css" />
		<link rel="stylesheet" href="../css/public.css" />
		<link rel="stylesheet" href="../css/login.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">手机快速注册</h1>
		</header>
		<div class="mui-content bg-white">
			
			<div class="locker-top">
				<div class="date-box">
					<span class="day">20</span>
					<span class="month">Feb.</span>
				</div>
				<div class="slogan">人生的价值，并非用时间，要用深度去衡量。</div>
			</div>
			
			<div id="alert" class="locker-status">绘制解锁图案</div>
			
			<div id="holder" class="mui-locker" data-locker-options='{"ringColor":"transparent","fillColor":"#c8c8c8","pointColor":"rgba(57,117,226,1)","lineColor":"rgba(57,117,226,1)"}' data-locker-width='300' data-locker-height='300'></div>
			
			<div class="locker-foot">
				<a href="javascript:void(0);" id="afresh" class="afresh">重新绘制手势</a>
				<a href="javascript:void(0);" id="skip" class="skip">跳过</a>
			</div>
		</div>
	</body>
	<script src="../js/mui.js"></script>
	<script src="../js/mui.locker.js"></script>
	<script>
		(function($, doc) {
			$.init();
			var holder = doc.querySelector('#holder'),
				alert = doc.querySelector('#alert'),
				afresh = doc.getElementById('afresh'),
				record = [];
			//处理事件
			holder.addEventListener('done', function(event) {
				var rs = event.detail;
				if (rs.points.length < 4) {
					alert.innerText = '设定的手势太简单了';
					record = [];
					rs.sender.clear();
					return;
				}
				console.log(rs.points.join(''));
				record.push(rs.points.join(''));
				if (record.length >= 2) {
					if (record[0] == record[1]) {
						alert.innerText = '手势设定完成';
						
						//注册成功
						var index=plus.webview.getLaunchWebview();//获得初始窗口
						plus.webview.show(index);//打开初始窗口
//						common.closeWin("login");
//						common.closeWin("reg");
//						common.closeWin("reg_two");
//						common.closeWin("reg_three");
//						common.closeWin();
						
					} else {
						alert.innerText = '两次手势设定不一致';
					}
					rs.sender.clear();
					record = [];
				} else {
					alert.innerText = '再次绘制解锁图案';
					afresh.classList.add("active");
					rs.sender.clear();
				}
			});
		}(mui, document));
		
		mui('.mui-scroll-wrapper').scroll({
			deceleration: 0.0005
		});
		
		//跳过
		document.getElementById("skip").addEventListener('tap', function() {
			var index=plus.webview.getLaunchWebview();//获得初始窗口
			plus.webview.show(index);//打开初始窗口
		});
	</script>
</html>